Key parquet column options by leaf path so nested columns get compressed - #8674
Open
jayzuccarelli wants to merge 1 commit into
Open
jayzuccarelli wants to merge 1 commit into
jayzuccarelli wants to merge 1 commit into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8671
Summary
pq.ParquetWritermatches per-columncompression/use_dictionary/column_encodingagainst the leaf column paths (train.list.element.input...), but bothParquetWriter._build_writerandParquetDatasetWriter._writekeyed them by top-level feature name. Nested list/struct columns never matched, so they fell back to pyarrow's defaults: uncompressed and no dictionary encoding.This moves the options into one
get_parquet_column_options(features, schema)helper inarrow_writer.pythat expands each column to its leaf paths, and uses it at both sites. Media columns (Image,Audio, ...) are structs too, so their"none"/PLAINsettings only held because unmatched leaves fell back to the defaults. The output for them is unchanged; the settings now actually match those leaves.Repro from the issue after the fix:
Test
Added
test_parquet_writer_compresses_nested_columnsintests/test_arrow_writer.py(flat, nested list/struct,Array2D,Image). It fails on main and passes with the fix.tests/test_arrow_writer.py,tests/io/test_parquet.py,tests/packaged_modules/test_parquet.pyandtests/features/test_image.pypass;make qualityis clean.